home *** CD-ROM | disk | FTP | other *** search
Text File | 1988-01-06 | 2.8 KB | 130 lines | [TEXT/MPS ] |
- TITLE 'Numeric formatting for pump driver'
- CASE ON
- BLANKS ON
-
- PRINT OFF
- INCLUDE 'Traps.a'
- INCLUDE 'ToolEqu.a'
- INCLUDE 'QuickEqu.a'
- INCLUDE 'SysEqu.a'
- LOAD 'ProgStrucMacs.d'
- LOAD 'FlowCtlMacs.d'
- PRINT ON
-
- ;
- ; This subroutine takes the decoded pump request (a character) and the
- ; pump info (a hex word), and returns a STR255 properly
- ; formatted to send to the pump, given a pointer to put the string into.
-
- EXPORT Procedure HexSet ( StringAddress:L , StringLength:L , PRqstStr:B , PInfo:W )
-
- Begin Save=A0/D0-D2;
-
- MOVE.L StringAddress(FP),A0
- MOVE.W PInfo(FP),D0
- MOVE.B PRqstStr(FP),(A0)+
- MOVE.B #'=',(A0)+
- For# D2 = #3 DownTo #0 Do.S
- LSL.L #4,D0 ;Grab next most significant nybble
- MOVE.L D0,D1 ;move to D1
- SWAP D1 ;put in low end of low word
- AND.W #$F,D1 ;mask off everything else
- MOVE.B TableBase(D1),(A0)+ ;grab character from table
- EndF#
- MOVE.B #13,(A0)+
- MOVE.B #10,(A0)+
-
- MOVE.L StringLength(FP),A0
- MOVE.L #8,(A0)
-
- Return
-
- STRING ASIS
- TableBase DC.B '0123456789ABCDEF'
-
- ENDP
-
- ;
- ; This subroutine takes the decoded pump request (a character) and the
- ; pump info (a decimal word), and returns a STR255 properly
- ; formatted to send to the pump, given a pointer to put the string into.
-
- MACRO
- NumToString
- LEA TempString(FP),A0
- CLR.W -(SP)
- _Pack7
- ENDM
-
-
- MACRO
- MaxTheString
- LCLC &MaxString
- &MaxString SETC &CONCAT(&CHR(4),'999')
- MOVE.L #'&MaxString',TempString(FP)
- LEA TempString(FP),A0
- ENDM
-
- MACRO
- MinTheString
- LCLC &MinString
- &MinString SETC &CONCAT(&CHR(1),'0')
- MOVE.W #'&MinString',TempString(FP)
- LEA TempString(FP),A0
- ENDM
-
- EXPORT Procedure IntegerSet ( StringAddress:L , StringLength:L , PRqstStr:B , PInfo:W )
-
- Var TempString:B[255]
- Begin Save=A0-A1/D2;
-
- MOVE.W PInfo(FP),D0
-
- If# D0 GT.W #999 Then.S
- MaxTheString
- ElseIf#.S D0 LE.W #0 Then.S
- MinTheString
- Else#.S
- NumToString
- EndIf#
-
- MOVE.B (A0)+,D0
- EXT.W D0
- MOVE.W D0,D1
- SUBQ.W #1,D0
- MOVE.L StringAddress(FP),A1
- MOVE.B PRqstStr(FP),(A1)+
- MOVE.B #'=',(A1)+
- For# D0 DownTo #0 Do.S
- MOVE.B (A0)+,(A1)+
- EndF#
- MOVE.B #13,(A1)+
- MOVE.B #10,(A1)+
-
- MOVE.L StringLength(FP),A0
- ADDQ.W #4,D1
- EXT.L D1
- MOVE.L D1,(A0)
-
- Return
- ENDP
-
- EXPORT Procedure AskFormat ( StringAddress:L , StringLength:L , PRqstStr:B )
-
- Begin Save=A0;
-
- MOVE.L StringAddress(FP),A0
- MOVE.B PRqstStr(FP),(A0)+
- MOVE.B #'?',(A0)+
- MOVE.B #13,(A0)+
- MOVE.B #10,(A0)+
-
- MOVE.L StringLength(FP),A0
- MOVE.L #4,(A0)
-
- Return
- ENDP
-
- END
-
-